package devicedbgui.data;
import java.util.Date;

/** Stores test result information */
public class TestResult {
    /** Stores test result id*/
    public int idTestResult;
    /** Stores name */
    public String name;
    /** Stores description of test result */
    public String description;
    /** Stores time of execution */
    public Date time;
    /** Stores test case id*/
    public int TestCase_idTestCase;
    
    // additional data
    /** Stores description of test case */
    public String testCaseDescription = "";
    /** Stores name of associated exe file */
    public String exeDescription = "";
    /** Stores name of associated device */
    public String deviceName = "";
    /** Stores serial of associated device */
    public String deviceSerial = "";
    /** Default Constructor of class TestResult */
    public TestResult(){}
    /** Constructor: initialises all components of class */
    public TestResult(int idTestResult,
        String name,
        String description,
        Date time,
        int TestCase_idTestCase)
    {
        this.idTestResult = idTestResult;
        this.name = name;
        this.description = description;
        this.time = time;
        this.TestCase_idTestCase = TestCase_idTestCase;
    }
    /* Returns name of test case */
    public String getTestCaseDetail()
    {
        if (testCaseDescription == null || testCaseDescription.equals(""))
            return "";
        String[] tmp = testCaseDescription.split(";");
        if (tmp.length != 2)
            return "";
        return tmp[0]; // test cases
    }
    /* Returns test case result */ 
    public String getTestCaseDescription()
    {
        if (testCaseDescription == null || testCaseDescription.equals(""))
            return "";
        String[] tmp = testCaseDescription.split(";");
        if (tmp.length != 2)
            return "";
        return tmp[1]; // test case result
    }
    /* Returns statement tested */
    public String getStatement()
    {
        return name; // statement will be saved in column name
    }
    /* Returns test result */
    public String getResultDetail()
    {
        return description; // result detail will be saved in column description
    }
}
